import Vue from "vue";
import VueRouter from "vue-router";

// 巡检端
const login = () =>
  import('@/views/login'); //登录
import home from '@/views/home' //首页
import taskDetail from '@/views/taskDetail' //任务详情
import precedure from '@/views/precedure' //手续办理
import publicSentiment from '@/views/publicSentiment' //舆情管控

//处置端
import login_wxh5 from '@/views/wxh5/login' //登录
import home_wxh5 from '@/views/wxh5/home' //首页
import taskDetail_wxh5 from '@/views/wxh5/taskDetail' //任务详情
import precedure_wxh5  from '@/views/wxh5/precedure' //手续办理
import over_wxh5  from '@/views/wxh5/over' //竣工验收
Vue.use(VueRouter);

const routes = [

  {
    path: '/wxh5/over',
    name: "竣工验收",
    component: over_wxh5,
    meta: {
      topBar: false, //顶部导航栏
    }
  },
  {
    path: '/wxh5/precedure',
    name: "手续办理",
    component: precedure_wxh5,
    meta: {
      topBar: false, //顶部导航栏
    }
  },
  {
    path: '/wxh5/taskDetail',
    name: "任务详情",
    component: taskDetail_wxh5,
    meta: {
      topBar: false, //顶部导航栏
    }
  },
  {
    // path: process.env.NODE_ENV =='production'? "/":'/home',
    path: '/wxh5/home',
    name: "首页",
    component: home_wxh5,
    meta: {
      topBar: false, //顶部导航栏
     
    }
  },
  {
    // path: process.env.NODE_ENV =='production'? "/home":'/',
    path: '/login',
    name: "登录",
    component: login_wxh5,
    meta: {
      topBar: false, //顶部导航栏
    }
  },
  {
    path: '/publicSentiment',
    name: "舆情管控",
    component: publicSentiment,
    meta: {
      topBar: false, //顶部导航栏
    }
  },
  {
    path: '/precedure',
    name: "手续办理",
    component: precedure,
    meta: {
      topBar: false, //顶部导航栏
    }
  },
  {
    path: '/taskDetail',
    name: "任务详情",
    component: taskDetail,
    meta: {
      topBar: false, //顶部导航栏
    }
  },
  {
    // path: process.env.NODE_ENV =='production'? "/":'/home',
    path: '/home',
    name: "首页",
    component: home,
    meta: {
      topBar: false, //顶部导航栏
     
    }
  },
  {
    // path: process.env.NODE_ENV =='production'? "/home":'/',
    path: '/',
    name: "登录",
    component: login,
    meta: {
      topBar: false, //顶部导航栏
    }
  },


];

const router = new VueRouter({
  // mode: "history",
  mode: "hash",
  base: '/',
  scrollBehavior(to, from, savedPosition) { //跳转路由置顶
    if (savedPosition) {
      return savedPosition
    } else {
      return {
        x: 0,
        y: 0
      }
    }
  },
  routes
});

export default router;